import numpy as np
import os
from shutil import copyfile

origin_wav_dir = '/Users/d/Project/emotions/data/iemocap_4emo_wav'
target_wav_dir = '/Users/d/Project/emotions/data/Wav_EN_Var'


def move_session(session_name):
    label_file = os.path.join(origin_wav_dir, session_name + '_sentence_label')
    with open(label_file, 'r') as inf:
        for line in inf:
            eles = line.split()
            if len(eles) == 2:
                src = os.path.join(origin_wav_dir, session_name, eles[0] + '.wav')
                dst = os.path.join(target_wav_dir, eles[0] + '_' + eles[1] + '.wav')
                copyfile(src, dst)


def main():
    session_names = ['Session1', 'Session2', 'Session3', 'Session4', 'Session5']
    for session_name in session_names:
        move_session(session_name)


if __name__ == '__main__':
    main()
